﻿@model IEnumerable<ArisanNgocok.ViewModels.UserPaymentsViewModel>
@{
   ViewBag.Title = "Status Pembayaran";
   ViewBag.Page  = "status";

   DateTime? lastModified = (DateTime?) ViewBag.LastModified;
}

<style type="text/css">
   .label-success {
	  width: 55px;
	  padding: 5px;
	  display: inline-block;
   }
</style>

<h2>Status Pembayaran</h2>

@if (lastModified.HasValue)
{
   <strong>Terakhir Diperbaharui: </strong>
   <em> @lastModified.Value.AddHours(7).ToString("f")</em>
}
@{
	var periodeOpts = (IEnumerable<SelectListItem>)ViewBag.PeriodeList;
}
<p>
	Pilih Bulan : @Html.DropDownList("periode", periodeOpts)
</p>
<table class="table table-bordered table-condensed table-hover">
   <thead>
	  <tr>
		 <th>Nama</th>
		 <th>Status Bayar</th>
		 <th>Status Arisan</th>
		 @if ((bool)ViewBag.Edit)
		 {
			<th></th>
		 }
	  </tr>
   </thead>
   <tbody>
	  @foreach (var payment in Model)
	  {
		 <tr>
			<td style="width: 70%">@payment.UserName</td>
			<td>
			   @if (payment.IsPaid.HasValue && payment.IsPaid.Value)
				{
					<span class="label label-success">SUDAH BAYAR</span>
				}
				else
				{
					<span class="label label-danger">BELUM BAYAR</span>
				}
			</td>
			 <td>
				 @if(payment.HasSelected)
				 {
					 <span class="label label-success">SUDAH DAPAT</span>
				 }
				 else
				 {
					 <span class="label label-danger">BELUM DAPAT</span>
				 }
			 </td>
			@if ((bool)ViewBag.Edit)
			{
			   <td><a href="@Url.Action("Toggle", new { paymentId = payment.PaymentID })">Change</a></td>
			}
		 </tr>
	  }
   </tbody>

</table>

@if ((bool)ViewBag.Edit)
{
   <a href="@Url.Action("Status")" class="btn btn-primary">Finish Editing</a>
}